//
//  Constans.h
//  MVVM
//
//  Created by 宜必鑫科技 on 2017/10/19.
//  Copyright © 2017年 宜必鑫科技. All rights reserved.
//

#ifndef Constans_h
#define Constans_h


//通过RGB设置颜色
#define RGBColor(R,G,B)        [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0]

//屏幕宽和高
#define ScreenWidth ([UIScreen mainScreen].bounds.size.width)
#define ScreenHeight ([UIScreen mainScreen].bounds.size.height)

// 缩放比
#define kScale ([UIScreen mainScreen].bounds.size.width) / 375

#define hScale ([UIScreen mainScreen].bounds.size.height) / 667

#define kAppDelegate ((AppDelegate*)([UIApplication sharedApplication].delegate))

#define kStoryboard(StoryboardName)     [UIStoryboard storyboardWithName:StoryboardName bundle:nil]

//通过Storyboard ID 在对应Storyboard中获取场景对象
#define kVCFromSb(storyboardId, storyboardName)     [[UIStoryboard storyboardWithName:storyboardName bundle:nil] \
instantiateViewControllerWithIdentifier:storyboardId]

//移除iOS7之后，cell默认左侧的分割线边距
#define kRemoveCellSeparator \
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{\
cell.separatorInset = UIEdgeInsetsZero;\
cell.layoutMargins = UIEdgeInsetsZero; \
cell.preservesSuperviewLayoutMargins = NO; \
}

//Docment文件夹目录
#define kDocumentPath NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject








#define XCODE_COLORS_ESCAPE @"\033["
#define XCODE_COLORS_RESET_FG  XCODE_COLORS_ESCAPE @"fg;"
#define XCODE_COLORS_RESET_BG  XCODE_COLORS_ESCAPE @"bg;"
#define XCODE_COLORS_RESET     XCODE_COLORS_ESCAPE @";"

/**  不同等级的Log，也可开关，当前已开  */
#define LOG_LEVEL_Warn
#define LOG_LEVEL_INFO
#define LOG_LEVEL_ERROR
//如需关闭，就将你需要关闭的宏定义注销那么该种形式的Log将不显示或者以默认颜色显示
#ifdef LOG_LEVEL_ERROR
#define WJLogError(frmt, ...) NSLog((XCODE_COLORS_ESCAPE @"fg255,0,0;" frmt XCODE_COLORS_RESET), ##__VA_ARGS__)
#else
#define WJLogError(...) //NSLog(__VA_ARGS__)
#endif

#ifdef LOG_LEVEL_INFO
#define WJLogInfo(frmt, ...) NSLog((XCODE_COLORS_ESCAPE @"fg65,105,225;" frmt  XCODE_COLORS_RESET), ##__VA_ARGS__)
#else
#define WJLogInfo(...) //NSLog(__VA_ARGS__)
#endif

#ifdef LOG_LEVEL_Warn
#define WJLogWarn(frmt, ...) NSLog((XCODE_COLORS_ESCAPE @"fg255,128,0;" frmt XCODE_COLORS_RESET), ##__VA_ARGS__)
#else
#define WJLogWarn(...) //NSLog(__VA_ARGS__)
#endif



/**  打印完整的log */
#ifdef DEBUG
#define WJLog(format, ...) printf("class: < %s:(%d) > method: %s \n%s\n", [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String] )
#else
#define WJLog(format, ...)
#endif










#endif /* Constans_h */
